package com.zwj.liteflow.liteflow.cmp;

import com.yomahub.liteflow.annotation.LiteflowCmpDefine;
import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.annotation.LiteflowMethod;
import com.yomahub.liteflow.core.NodeComponent;
import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
import com.zwj.liteflow.domain.params.LifeParam;
import com.zwj.liteflow.liteflow.context.LifeContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author 摸鱼二长老
 * @version 1.0
 * @Date 2023/3/2 2:24 PM
 */
@LiteflowComponent("born")
@LiteflowCmpDefine
public class BornCMP {
    private static final Logger LOGGER = LoggerFactory.getLogger(BornCMP.class);

    @LiteflowMethod(LiteFlowMethodEnum.PROCESS)
    public void processBornCmp(NodeComponent nodeComponent) {
        LOGGER.info("-----------------------------出生流程start-----------------------------");
        LifeParam requestData = nodeComponent.getSlot().getRequestData();
        LOGGER.info("姓名：{},年龄：{}",requestData.getName(),requestData.getAge());
        LOGGER.info("-----------------------------执行出生流程-----------------------------");
        LifeContext contextBean = nodeComponent.getContextBean(LifeContext.class);
        contextBean.setStatus("👴🏻出生了，没想到吧");
        contextBean.setAction("👴🏻刚落地就能🏃🏻‍♀️嘿嘿");
        LOGGER.info("-----------------------------出生流程end-----------------------------");
    }
}
